package com.ruoyi.consumables.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumables.mapper.ReceiveRecordMapper;
import com.ruoyi.consumables.domain.ReceiveRecord;
import com.ruoyi.consumables.service.IReceiveRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 领用记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-22
 */
@Service
public class ReceiveRecordServiceImpl implements IReceiveRecordService 
{
    @Autowired
    private ReceiveRecordMapper receiveRecordMapper;

    /**
     * 查询领用记录
     * 
     * @param receiveId 领用记录主键
     * @return 领用记录
     */
    @Override
    public ReceiveRecord selectReceiveRecordByReceiveId(Long receiveId)
    {
        return receiveRecordMapper.selectReceiveRecordByReceiveId(receiveId);
    }

    /**
     * 查询领用记录列表
     * 
     * @param receiveRecord 领用记录
     * @return 领用记录
     */
    @Override
    public List<ReceiveRecord> selectReceiveRecordList(ReceiveRecord receiveRecord)
    {
        return receiveRecordMapper.selectReceiveRecordList(receiveRecord);
    }

    /**
     * 新增领用记录
     * 
     * @param receiveRecord 领用记录
     * @return 结果
     */
    @Override
    public int insertReceiveRecord(ReceiveRecord receiveRecord)
    {
        receiveRecord.setCreateTime(DateUtils.getNowDate());
        return receiveRecordMapper.insertReceiveRecord(receiveRecord);
    }

    /**
     * 修改领用记录
     * 
     * @param receiveRecord 领用记录
     * @return 结果
     */
    @Override
    public int updateReceiveRecord(ReceiveRecord receiveRecord)
    {
        receiveRecord.setUpdateTime(DateUtils.getNowDate());
        return receiveRecordMapper.updateReceiveRecord(receiveRecord);
    }

    /**
     * 批量删除领用记录
     * 
     * @param receiveIds 需要删除的领用记录主键
     * @return 结果
     */
    @Override
    public int deleteReceiveRecordByReceiveIds(String receiveIds)
    {
        return receiveRecordMapper.deleteReceiveRecordByReceiveIds(Convert.toStrArray(receiveIds));
    }

    /**
     * 删除领用记录信息
     * 
     * @param receiveId 领用记录主键
     * @return 结果
     */
    @Override
    public int deleteReceiveRecordByReceiveId(Long receiveId)
    {
        return receiveRecordMapper.deleteReceiveRecordByReceiveId(receiveId);
    }
}
